from flask import render_template, session
from . import web_bp
from models import get_all_operation_logs, get_all_login_logs

# 操作日志管理
@web_bp.route('/logs/operations')
def operation_logs():
    if 'user_id' not in session:
        return redirect('/login')
    
    logs = get_all_operation_logs()
    return render_template('operation_logs.html', logs=logs)

# 登录日志管理
@web_bp.route('/logs/login')
def login_logs():
    if 'user_id' not in session:
        return redirect('/login')
    
    logs = get_all_login_logs()
    return render_template('login_logs.html', logs=logs)